﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TemplateWeb.Models.ViewModels.GroupViewModel>" %>
<%@ Import Namespace="TemplateWeb.Helpers" %>
<div class="AdminPageText">
Danh sách hiển thị
</div>
<% using (Html.BeginForm("UpdateHoTro", "Admin", FormMethod.Post, new { id = "MySubmitForm", onsubmit = "return ValidateHoTro();" }))
   { %>
<table class="Grid" cellpadding="0" cellspacing="0">
	<thead>
		<tr>
			<th>HoTen</th>
			<th>NickName</th>
			<th>Phone</th>
			<th></th>
			<th></th>
		</tr>
	</thead>
	<% for (int i=0; i<Model.HoTroModel.GetModel.LstObjModel.Count; i++){
		if (i % 2 != 0) {%>
		<tr class="Row" id="row-<%= Model.HoTroModel.GetModel.LstObjModel[i].ID %>">
		<% }
		else { %>
		<tr class="AlternatingRow" id="row-<%= Model.HoTroModel.GetModel.LstObjModel[i].ID %>">
		<% } %>
		<% if (Model.HoTroModel.GetModel.LstObjModel[i].ID == Model.HoTroModel.EditModel.ID){ %>
			<td>
				<%= Html.TextBox("HoTro_HoTen", Model.HoTroModel.GetModel.LstObjModel[i].HoTen, new { @Style = ""})%>
			</td>
			<td>
				<%= Html.TextBox("HoTro_NickName", Model.HoTroModel.GetModel.LstObjModel[i].NickName, new { @Style = ""})%>
			</td>
			<td>
				<%= Html.TextBox("HoTro_Phone", Model.HoTroModel.GetModel.LstObjModel[i].Phone, new { @Style = ""})%>
			</td>
			<td>
				<a href="#" onclick="submitForm();">
					<span style="color: Blue; text-decoration: underline">Update</span>
				</a>
				&nbsp;
				<%= Html.Hidden("HoTro_CurrentPage", Model.HoTroModel.GetModel.CurrentPage) %>
				<%= Html.Hidden("HoTro_ID", Model.HoTroModel.GetModel.LstObjModel[i].ID)%>
				<%= Ajax.ActionLink("Cancel", "CancelEditingHoTro", "Admin", new { page = Model.HoTroModel.GetModel.CurrentPage }, new AjaxOptions { UpdateTargetId = "PartialDiv" })%>
			</td>
			<td>
				<a href="../../Admin/DeleteHoTro?id=<%= Model.HoTroModel.GetModel.LstObjModel[i].ID %>&page=<%= Model.HoTroModel.GetModel.CurrentPage %>" onclick="return confirm('Are you sure you want to Delete it? This action cannot be undone.');">Delete</a>
			</td>
		<% }else{ %>
			<td><%= Model.HoTroModel.GetModel.LstObjModel[i].HoTen %></td>
			<td><%= Model.HoTroModel.GetModel.LstObjModel[i].NickName %></td>
			<td><%= Model.HoTroModel.GetModel.LstObjModel[i].Phone %></td>
			<td>
				<%= Ajax.ActionLink("Edit", "EditHoTro", "Admin", new { page = Model.HoTroModel.GetModel.CurrentPage, id = Model.HoTroModel.GetModel.LstObjModel[i].ID }, new AjaxOptions { UpdateTargetId = "PartialDiv" })%>
			</td>
			<td>
				<a href="../../Admin/DeleteHoTro?id=<%= Model.HoTroModel.GetModel.LstObjModel[i].ID %>&page=<%= Model.HoTroModel.GetModel.CurrentPage %>" onclick="return confirm('Are you sure you want to Delete it? This action cannot be undone.');">Delete</a>
			</td>
		<% } %>
		</tr>
	<% } %>  
</table>
<% } %>